#ifndef ______WARD___TEXTBOX_H
#define ______WARD___TEXTBOX_H


#include "uielement.h"
#include "driver.h"
#include "colorScheme.h"



class textBox : public uielement
{

public:

	textBox(int x = 0, int y = 0,  int w = 16, string t = "") :uielement(),h_offs(0.2) { this->xpos = x; this->ypos = y; border = 2; width = w; data = 0; text = t; hovering = false; truncate_fileext = true;}

	void select() { data = !data; }
	void left() {}
	void right() {}

	string getString() { return text; }
	void setString(string s)  { text = s; }

	void draw() { drawEnabled(xpos, ypos); }
	void drawAt(int x, int y) { drawEnabled(x, y); }
	bool clicked(int x, int y) { bool ret = (((x>=xpos)&&(x<=(xpos+width)))&&((y>=ypos)&&(y<=(ypos+16)))); return ret;}
	bool hover(int x, int y) { return (((x>=xpos)&&(x<=(xpos+width)))&&((y>=ypos)&&(y<=(ypos+16)))); }

	void onClick() { select(); }
	void setHover(bool h) { hovering = h; }


	float getData() { return data; }
	void setData(float f) { f = data; }

private:
	
	bool hovering;
	bool truncate_fileext;
	const float h_offs;
	void drawEnabled(int x, int y);
	void drawDisabled();
	int border, width;
	string text;
};




#endif